import moment from 'moment'
import 'moment/dist/locale/zh-cn'
moment.locale('zh-cn') //中文化


// 11:49
export const getFullTime = (time) => {
  if(time){
    const now = new Date().getTime(); // 获取当前时间
    if( (now - (time * 1000)) > (86400000 * 3)){
      return moment(time * 1000).format('L')
    } else if( (now - (time * 1000)) > (86400000 * 2)){
      return "前天"
    } else if( (now - (time * 1000)) > 86400000){
      return "昨天"
    } else {
      return moment(time * 1000).format('LT');   
    }
  }
}


export const getChatTime = (time) => {
  if(time){
    const now = new Date().getTime(); // 获取当前时间
    return (now - (time * 1000)) > 86400000
  }
}

// 获取星期几
// export const getWeek = (time) => {
//   if(time){
//     return moment(time).format('dddd');
//   }else {
//     return moment().format('dddd');
//   }
// }